from datetime import datetime

from pydantic import create_model

from core.utils.date_utils import datetime_to_str

# 定义全局pydantic 的Model,可以继承此Model,对json格式的序列化
GlobalBaseModel = create_model(
    'GlobalBaseModel',
    __config__={
        "json_encoders": {
            datetime: datetime_to_str
        },
    }
)
